' VBMEM v3.2 by Charles K. Snider 02/94 ' Send any and all comments to Compuserve 73730,1315 DefInt A-Z Declare Function GetFreeSpace Lib "Kernel" (ByVal wFlags) As Long Declare Function GetFreeSystemResources% Lib "User" (ByVal wType%) Declare Function GetWinFlags Lib "Kernel" () As Long Const WF_ENHANCED = &H20 Dim FreeMem As String Dim FreeRes As String Sub Form_Load () Dim WinFlags As Long Dim Mode As String ' Center window Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2 ' Get current Windows configuration WinFlags = GetWinFlags() If WinFlags And WF_ENHANCED Then Mode = "386 Enhanced Mode" Else Mode = "Standard Mode" End If ' Get info for initial and display it Lbl_Mde.Caption = Mode Lbl_Res.Caption = Format$(GetFreeSystemResources%(0) / 100, "00%") Lbl_Mem.Caption = Format$(GetFreeSpace(0) \ 1024, "##,#00") + " KB" End Sub Sub Form_Resize () ' Initial check if the application is minimized. ' If so, display free memory in caption NL$ = Chr$(13) + Chr$(10) If Frm_Info.WindowState = 1 Then FreeMem = Format$(GetFreeSpace(0) \ 1024, "##,#00") + " KB Free" FreeRes = Format$(GetFreeSystemResources%(0) / 100, "00%") + " Left" If FreeMem + NL$ + FreeRes <> Frm_Info.Caption Then Frm_Info.Caption = FreeMem + NL$ + FreeRes Else Frm_Info.Caption = "System Info" End If End Sub Sub Pic_Pc_Click () ' Display About Box NL$ = Chr$(13) + Chr$(10) Msg$ = "by Charles K. Snider" + NL$ + "CIS 73730,1315" MsgBox Msg$, 64, "VBMEM v3.2" End Sub Sub Tmr_Mem_Timer () ' Carriage return and new line NL$ = Chr$(13) + Chr$(10) ' Get free memory and resources FreeMem = Format$(GetFreeSpace(0) \ 1024, "##,#00") + " KB" FreeRes = Format$(GetFreeSystemResources%(0) / 100, "00%") ' Check if the application is minimized ' If so, display free memory in caption ' Display changes only if memory changed If Frm_Info.WindowState = 1 Then FreeMem = Format$(GetFreeSpace(0) \ 1024, "##,#00") + " KB Free" FreeRes = Format$(GetFreeSystemResources%(0) / 100, "00%") + " Left" If FreeMem + NL$ + FreeRes <> Frm_Info.Caption Then Frm_Info.Caption = FreeMem + NL$ + FreeRes Else Frm_Info.Caption = "System Info" If FreeRes <> Lbl_Res.Caption Then Lbl_Res.Caption = FreeRes If FreeMem <> Lbl_Mem.Caption Then Lbl_Mem.Caption = FreeMem End If End Sub